#include <dolphin/socket.h>
int SORead ( int s, void* buf, int len );
int SORecv ( int s, void* buf, int len, int flags );
int SORecvFrom ( int s, void* buf, int len, int flags,
void* sockFrom );
SORead(), SORecv() and SORecvFrom() attempt to read len
bytes from the other end of the socket.
SORead() is equivalent to SORecv()
with no flags set.
SORead(), SORecv() and SORecvFrom()
block until a message arrives if no messages are available in the socket's
receive buffer, unless the socket descriptor is set to the nonblocking mode with SOFcntl()
(or
SO_MSG_DONTWAIT flag is specified).
For SOCK_DGRAM sockets, the entire message is read in a single operation.
If a message is too long to fit in the supplied buffer, and MSG_PEEK
is not set in the flags, the excess bytes is
discarded. For SOCK_STREAM sockets, message
boundaries is ignored. In this case, data is returned to the user as soon as
it becomes available.
Note: The GameCube socket library employs Berkeley interpretation for the TCP urgent pointer: The TCP urgent pointer points to the byte next to the urgent byte.
s |
The socket descriptor. | ||||||
buf |
A pointer to the receive buffer. | ||||||
len |
The length of the receive buffer. | ||||||
flags |
Specifies the type of message reception: the flags are formed by
logically OR'ing zero or more of the following values:
|
||||||
sockFrom |
A pointer to a socket address structure to retrieve the name of the peer.
The len field of the socket address must be properly
initialized (e.g., sizeof(SOSockAddrIn)). |
| non-negative | The length of the message in bytes written to the buffer. |
SO_EAGAIN |
SO_O_NONBLOCK is set for the socket descriptor (or
SO_MSG_DONTWAIT flag is specified) and there is
no data or out-of-band data waiting to be received. |
SO_EBADF |
Bad socket descriptor. |
SO_ECONNRESET |
Connection reset. |
SO_EINTR |
Canceled. |
SO_EINVAL |
Invalid operation. |
SO_ENETRESET |
Socket library is not initialized. |
SO_ENOTCONN |
Not connected. |
SO_EOPNOTSUPP |
Non-supported operation. |
SO_ETIMEDOUT |
Timed out. |
SO_EWOULDBLOCK |
Same as SO_EAGAIN. |
Note: Additional errors may be generated and returned in future library releases. All the negative return values must be treated as generic errors.